<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>

	<body>
		<div id="app">
			<!-- isShow变量是Vue实例的变量，值为true，所以显示 -->
			<cpn v-show="isShow"></cpn>
		</div>

		<template id="cpn">
			<div>
				<h2>我是子组件</h2>
				<p>我是内容，哈只哈</p>
				<!-- isShow变量是子组件的变量，值为false，所以不显示 -->
				<button v-show="isShow">按钮</button>
			</div>
		</template>
		<script src="../lib/vue.js"></script>
		<script>
			let vm = new Vue({
				el: "#app",
				data: { message: "hello", isShow: true },
				components: {
					cpn: {
						template: "#cpn",
						data() {
							return {
								isShow: false
							};
						}
					}
				}
			});
		</script>
	</body>
</html>
